package mapper

import (
	"github.com/beego/beego/v2/client/orm"
	"ksd-social-api/modules/platform/model"
)

type PlatformSystemMapper struct {
}

/**
 * 查找栏目信息
 * @author feige
 * @date 2023-11-03
 * @version 1.0
 * @desc
 */
func (mapper *PlatformSystemMapper) GetPlatformSystem(systemId uint64) (*model.PlatformSystem, error) {
	// 获取数据库链接
	mysql := orm.NewOrm()
	// 准备一个切片容器
	var platformSystem model.PlatformSystem
	// 执行查询
	err := mysql.
		Raw(`select 
			id,
			sysname,
			syscode,
			create_time,
			update_time,
			open_flag,
			default_flag,
			domain,
			footer_html,
			logo,
			status,
			qqlink,
			tglink,
			twlink,
			bookmark,
			is_deleted,
			password,
			keywords,
			description,
			footcode,
			headcode,
			commercial_tg,
			weixinlink
    	from xk_system where  id = ?`, systemId).
		QueryRow(&platformSystem)
	if err != nil {
		return nil, err
	}
	return &platformSystem, nil
}
